class Solution(object):
    def titleToNumber(self, s):
        """
        :type s: str
        :rtype: int
        """
        if not s:
            return 0
        num = 0
        for i in range(len(s)):
            num += (26**(len(s)-1-i) * (ord(s[i]) - 64))
        return num